﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PagedList<ISupportTicket>>" %>

<asp:Content ID="Content3" ContentPlaceHolderID="JSContent" runat="server">
    <script type="text/javascript" src="/Scripts/jquery-1.4.3.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $(".add-support-ticket").click(function () {
                $(".new_supportticket").toggle("slow");
            });

            $("form").submit(function () {
                try {
                    $.post(
                    $(this).attr("action"),
                    $(this).serialize(),
                    function (rspData, status, xhr) {
                        if (!rspData.Message) {
                            window.location.href = window.location.href;
                        }
                        else {
                            alert(rspData.Message);
                        }
                    },
                    "json");
                } catch (ex) {
                    alert(ex);
                }
                return false;
            });

        });
    </script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <%: Html.Partial("Sidebar") %>
    <div id="main">
        <div class="main-block">
            <h2 class="title">
                <%:"Support ticket".Localize() %></h2>
            <div id="message-box-error" class="hide message-box error message-box-error">
                <p>
                </p>
            </div>
            <div id="message-box-info" class="hide message-box info message-box-info">
                <p>
                </p>
            </div>
            <div class="main-block-content clearfix">
                <div class="tabs">
                    <a href="<%= this.ViewData["ProfileLinks"].Bind("Profile") %>">
                        <%:"Account Info".Localize() %></a> <a href="<%= this.ViewData["ProfileLinks"].Bind("Password") %>">
                            <%:"Change Password".Localize() %></a> <a href="<%= this.ViewData["ProfileLinks"].Bind("Address") %>">
                                <%:"Address Lists".Localize() %></a> <a href="<%= this.ViewData["ProfileLinks"].Bind("Order") %>">
                                    <%:"My Orders".Localize() %></a> <a class="current" href="<%= this.ViewData["ProfileLinks"].Bind("SupportTicket") %>">
                                        <%:"Support Ticket".Localize() %></a>
                </div>
                <div class="tab-content">
                    <div class="common-table">
                        <table>
                            <thead>
                                <tr>
                                    <th>
                                        <%:"Subject".Localize() %>
                                    </th>
                                    <th class="date">
                                        <%:"Date".Localize() %>
                                    </th>
                                    <th class="status">
                                        <%:"Status".Localize() %>
                                    </th>
                                    <th class="action">
                                        <%:"View".Localize() %>
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                <%
                                    foreach (var item in this.Model)
                                    {
                                        var detailUrl = this.Url.Action("SupportTicketDetail", new { id = item.Id });
                                %>
                                <tr>
                                    <td>
                                        <a href="<%: detailUrl %>">
                                            <%: item.Subject %>
                                        </a>
                                    </td>
                                    <td>
                                        <%: item.CreateDate.ToString() %>
                                    </td>
                                    <td>
                                        <%: item.Status %>
                                    </td>
                                    <td>
                                        <a href="<%:detailUrl %>">View</a>
                                    </td>
                                </tr>
                                <%
                                    }
                                
                                %>
                            </tbody>
                        </table>
                    </div>
                    <div class="tab-block">
                        <a href="javascript:void(0);" class="button add-support-ticket"><span>Send a new support ticket</span></a>
                        <div class="common-form hide new_supportticket">
                            <form method="post" action="<%: this.Url.Action("SupportTicket") %>">
                            <input type="hidden" name="Customer.Id" value="<%: this.ViewBag.CustomerId %>" />
                            <fieldset>
                                <p>
                                    <label for="subject">
                                        <%:"Subject:".Localize() %>
                                    </label>
                                    <input type="text" id="Subject" name="Subject">
                                </p>
                                <p>
                                    <label for="email">
                                        <%:"Email:".Localize() %></label>
                                    <input type="text" id="Email" name="Email" value="<%: this.ViewData["CustomerEmail"] %>" />
                                </p>
                                <p>
                                    <label for="Body">
                                        <%:"Content:".Localize() %></label>
                                    <textarea id="Body" name="Body" cols="90" rows="10"></textarea>
                                </p>
                            </fieldset>
                            <fieldset class="buttons">
                                <button type="submit" class="button">
                                    <span>
                                        <%:"Send".Localize() %></span></button>
                            </fieldset>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Breadcrumb" runat="server">
    <ul class="breadcrumb">
        <li><a href="/">
            <%:"Home".Localize() %></a>&gt;</li>
        <li><a href="/my">
            <%:"Account".Localize() %></a>&gt;</li>
        <li>
            <%:"Orders".Localize() %></li>
    </ul>
</asp:Content>
